// Copyright 2023 ByteDance and/or its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.bytedance.sdk.douyin.open.ability.share

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.widget.Toast
import com.bytedance.sdk.open.aweme.CommonConstants

/**
 * 用户留在抖音的情况下会广播通知
 */
class StayInDyReceiver : BroadcastReceiver() {

    companion object {
        const val SHARE_ACTION = CommonConstants.a
        const val IM_ACTION = "com.aweme.opensdk.action.stay.in.dy.im"
    }

    override fun onReceive(context: Context?, intent: Intent?) {
        if (intent?.action == SHARE_ACTION) {
            //分享成功，留在抖音
            Toast.makeText(context, "分享成功，留在抖音", Toast.LENGTH_SHORT).show()
        } else if (intent?.action == IM_ACTION) {
            //分享给好友成功，留在抖音
            Toast.makeText(context, "分享给好友成功，留在抖音", Toast.LENGTH_SHORT).show()
        }
    }
}